package com.longge;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MapArray {

    public List<Integer> getMapArray(List<Integer> arr){

        List<Integer> res = new ArrayList<>();
        for (Integer num : arr) {
            if (containsNum(res,num))continue;
            res.add(num);
        }
        return res;
    }

    private boolean containsNum(List<Integer> res, Integer num) {

        for (Integer re : res) {
            if (re.equals(num)) return true;
        }
        return false;
    }

    public static void main(String[] args) {
        List<Integer> mapArray = new MapArray().getMapArray(Arrays.asList(1, 1, 2, 2, 2, 3, 3, 3, 4, 4));
        System.out.println(mapArray);
    }
}
